<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePurchaseReturnItemsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('purchase_return_items', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('order_id')->default(0)->unsigned()->index()->comment('采购退货订单ID');
            $table->integer('product_id')->default(0)->unsigned()->index()->comment('采购退货产品id');
            $table->integer('num')->default(0)->unsigned()->comment('退货出库数量');
            $table->decimal('price',8,2)->default(0.00)->unsigned()->comment('退货价格');
            $table->decimal('total_price',8,2)->default(0.00)->unsigned()->comment('采购退货总价');
            $table->tinyInteger('is_enable')->default(1)->unsigned()->comment('是否有效，0-否，1-是');
            $table->timestamps();
        });
        \DB::statement("ALTER TABLE `purchase_return_items` comment '采购退货订单条目表'");


    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('purchase_return_items');
    }
}
